import { post } from '../../http'
import store from '@/store'


//发布竞价
export const releaseBiddingMethod = ({
  bidIds,
  bidId,
  bidBiddingstatus,
  bidSignupStart,
  bidSignupEnd,
  bidBiddingStart,
  bidBiddingEnd,
  bidServiceCharge,
  bidOfferStart,
  bidOfferEnd,
  bidAppointIds,
  bidInternalStatus
}) => {
  return post('/FTKJWLHYPT/bidding/releaseBiddingMethod', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          bidIds,
          bidId,
          bidBiddingstatus,
          bidSignupStart,
          bidSignupEnd,
          bidBiddingStart,
          bidBiddingEnd,
          bidServiceCharge,
          bidOfferStart,
          bidOfferEnd,
          bidAppointIds,
          bidInternalStatus,
          bidAppointMan: store.state.user.DPTID_DX_H,
          bidEditor: store.state.user.USR_CODE_DX_H,
          // fltUuid: store.state.user.FLT_UUID_DX_H,
        }
      }
    }
  })
}
//报名竞价之前修改供应商
export const updategys = ({
  bidId,
  bidAppointIds
}) =>
  post(
    '/FTKJWLHYPT/bidding/addGys',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            bidId,
            bidAppointIds
          }
        },
      }
    }
  )

//查询所有糖厂需求
export const queryDemandList = ({
  sugarId,
}) =>
  post(
    '/FTKJWLHYPT/sugarFactoryDemand/queryDemandBySugarId',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            sugarId,
          }
        },
      }
    }
  )

//查询竞价公告信息
export const queryAnnouncement = ({
  bidId,
  bidType
}) => {
  return post('/FTKJWLHYPT/bidding/queryAnnouncement', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          bidId,
          bidType
        }
      }
    }
  })
}


//更新或新增公告
export const addAnnouncement = ({
  baId,
  bidId,
  bidTitle,
  bidContent,
  bidType
}) => {
  return post('/FTKJWLHYPT/bidding/addAnnouncement', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          baId,
          bidId,
          bidTitle,
          bidContent,
          bidType,
          editor: store.state.user.USR_CODE_DX_H,
          // fltUuid: store.state.user.FLT_UUID_DX_H,
        }
      }
    }
  })
}

//内部指定（跳过竞价系列）
export const internalSpecifyBidding = ({
  bidId,
  sugarIds,
  bidBiddingstatus,
  bidInternalSpecify,
  bidInternalStatus,
  biddingPrice,
}) => {
  return post('/FTKJWLHYPT/bidding/internalSpecifyBidding', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          bidId,
          sugarIds,
          bidBiddingstatus,
          bidInternalSpecify,
          bidInternalStatus,
          biddingPrice,
          bidEditor: store.state.user.USR_CODE_DX_H,
          // fltUuid: store.state.user.FLT_UUID_DX_H,
        }
      }
    }
  })
}

//内部指定（跳过竞价系列）(按需内部指定)
export const internalDesignationBidding = ({
  id,
  bidId,
  sugarId,
  bidInternalId,
  biddingQuota,
  biddingPrice,
}) => {
  return post('/FTKJWLHYPT/bidding/internalDesignation', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          id,
          bidId,
          sugarId,
          bidInternalId,
          biddingQuota,
          biddingPrice,
          creator: store.state.user.USR_CODE_DX_H,
          // fltUuid: store.state.user.FLT_UUID_DX_H,
        }
      }
    }
  })
}

//取消内部指定（跳过竞价系列）(按需内部指定)
export const delInternalDesignation = ({
  sugarId,
  bidId,
}) => {
  return post('/FTKJWLHYPT/bidding/delInternalDesignation', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          sugarId,
          bidId,
          creator: store.state.user.USR_CODE_DX_H,
          // fltUuid: store.state.user.FLT_UUID_DX_H,
        }
      }
    }
  })
}

//查询需求关联内部指定表
export const querySugarListDetail = data => {
  return post('/FTKJWLHYPT/bidding/querySugarListDetail', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          bidId: data.bidId
        }
      }
    }
  })
}

//查询内部指定详细
export const internalDesignationDetail = ({
  sugarId,
  bidId,
}) => {
  return post('/FTKJWLHYPT/bidding/internalDesignationDetail', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          sugarId,
          bidId,
        }
      }
    }
  })
}
